package server

import (
	"fmt"
	"net/http"

	"starsine.cn/appTpl/svccenter/registry/restful/ws-server"
	"starsine.cn/appTpl/svccenter/registry/restful/wshandler"
)

func wsUpgrade(w http.ResponseWriter, r *http.Request) error {
	conn := ws.WSHandler(w, r)
	if conn == nil {
		return fmt.Errorf("ws.WSHandler fail")
	}

	conn.RegisterProc(wshandler.WsMsgHandler)
	conn.Start()
	return nil
}
